package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 韩先楚
 */
@Mapper
public interface ShoppingCartMapper {

    /**
     * 查询购物车表
     * @return
     */
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    /**
     * 购物车数量加一
     */
    @Update("update shopping_cart set number = number + 1 where id = #{id}")
    void add(Long id);

    /**
     * 添加购物车
     */
    void save(ShoppingCart shoppingCart);

    /**
     *
     * 清空购物车
     */
    @Delete("delete from shopping_cart where user_id = #{currentId}")
    void clean(Long currentId);
}
